package com.finna.tenant.dto;

import lombok.Data;
import java.util.List;

/**
 * 分页响应
 */
@Data
public class PageResponse<T> {
    
    private List<T> data;
    
    private Long total;
    
    private Integer page;
    
    private Integer pageSize;
    
    private Integer totalPages;

    public PageResponse() {
    }
    
    public PageResponse(List<T> data, Long total, Integer page, Integer pageSize) {
        this.data = data;
        this.total = total;
        this.page = page;
        this.pageSize = pageSize;
        this.totalPages = (int) Math.ceil((double) total / pageSize);
    }
}

